package com.hnas.eCard.domain;

/**
 * 
 * 功能说明: 返回接口卡状态类型转换 <br>
 * 注意事项: <br>
 * 开发人员: ds.zeng<br>
 * 创建时间: 2018年2月27日 下午5:03:49<br>
 */
public class ReturnECardMapper {

	/**
	 * 返回接口卡状态类型转换 
	 * @param searchStatus
	 * @param dataStatus
	 * @return
	 */
	public static String getReturnECardStatus(String searchStatus,String dataStatus){
		//1、可使用
		if(SearchECardStatus.USED.equals(searchStatus)&&ECardStatus.NORMAL.equals(dataStatus)){
			return ReturnECardStatus.NORMAL;
		}
		
		//2、已收到
		if(SearchECardStatus.RECEIVED.equals(searchStatus)){
			//已领取
			if(CardTrailStatus.CONFIRM_RECEIVE_GIVE.equals(dataStatus)){
				return ReturnECardStatus.RECEIVED;
			}
			//领取中
			if(CardTrailStatus.RECEIVING_GIVING.equals(dataStatus)){
				return ReturnECardStatus.RECEIVING;
			}
			//已收到，拒绝领取
			if(CardTrailStatus.REFUSE.equals(dataStatus)){
				return ReturnECardStatus.RECEIVE_FAIL;
			}
			//已收到，对方取消赠送
			if(CardTrailStatus.CANCEL_GIVE.equals(dataStatus)){
				return ReturnECardStatus.PASSIVE_CANCEL_GIVE;
			}
			//过期自动退回
			if(CardTrailStatus.OVERTIME.equals(dataStatus)){
				return ReturnECardStatus.OVERTIME;
			}
		}
		
		//3、已赠送
		if(SearchECardStatus.PRESENTED.equals(searchStatus)){
			//赠送中(已赠送，对方未领取)
			if(CardTrailStatus.RECEIVING_GIVING.equals(dataStatus)){
				return ReturnECardStatus.PRESENTING;
			}
			//已赠送，对方已领取
			if(CardTrailStatus.CONFIRM_RECEIVE_GIVE.equals(dataStatus)){
				return ReturnECardStatus.PRESENTED;
			}
			//已赠送，对方拒绝
			if(CardTrailStatus.REFUSE.equals(dataStatus)){
				return ReturnECardStatus.PRESENT_FAIL;
			}
			//已赠送，取消赠送
			if(CardTrailStatus.CANCEL_GIVE.equals(dataStatus)){
				return ReturnECardStatus.ACTIVE_CANCEL_GIVE;
			}
			//过期自动退回
			if(CardTrailStatus.OVERTIME.equals(dataStatus)){
				return ReturnECardStatus.OVERTIME;
			}
		}
		
		//4、已退卡
		if(SearchECardStatus.BACK.equals(searchStatus)){
			//已退卡
			if(ECardStatus.BACK_CARD.equals(dataStatus)){
				return ReturnECardStatus.BACK_CARD;
			}
			//退卡中
			if(ECardStatus.BACK_CARDING.equals(dataStatus)){
				return ReturnECardStatus.BACK_CARDING;
			}
		}
		
		return null;
	}
}
